package com.ludomancy.insane;


import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import com.ludomancy.gamelib.Widget;

public class MainWidget extends Widget
{
	public MainWidget(Widget parent, Rectangle area)
	{
		super(parent, area);
	}
	
	public void update()
	{
		Game.game.update();
	}
	
	public void paint(Graphics g)
	{
		Game.game.earth.paint(g);
		Game.game.world.paint(g);
	}

	public void mouseMoved(Point point)
	{
		Game.game.player.setTarget(Game.game.world.projector.screenToWorld(point));
	}

	public void mouseDown(Point pos)
	{
		Game.game.player.activated = true;
		mouseMoved(pos);
	}

	public void mouseUp(Point pos)
	{
		Game.game.player.activated = false;
	}

	public void onMouseLeave()
	{
		Game.game.player.activated = false;
	}
}
